package com.ghck.server.dao;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import com.ghck.server.dao.provider.HospitalDictProvider;
import com.ghck.server.model.HospitalDict;
import com.ghck.server.model.query.HospitalDictQuery;
/**
 * 医院  <br>
 * dict_hospital <br>
 * v1.0 2016-05-01
 */
 public interface HospitalDictMapper {
 	
 	/**
 	*根据id删除 医院
 	*/
 	@Delete("delete from dict_hospital where id=#{id}")
 	public Integer deleteById(Integer id);
 	
 	/**
 	* 批量新增 医院
 	*/
 	@InsertProvider(method="batchInsert",type=HospitalDictProvider.class)
	@Options(useGeneratedKeys=true,keyColumn="id",keyProperty="list[0].id")
 	public Integer batchInsert(List<? extends HospitalDict> hospitalDicts);
 	
 	/**
 	* 新增 医院
 	*/
 	@InsertProvider(method="insert",type=HospitalDictProvider.class)
	@Options(useGeneratedKeys=true)
 	public Integer insert(HospitalDict domain);
 
 	
 	/**
 	*更新 医院
 	*/
 	@UpdateProvider(method="update",type=HospitalDictProvider.class)
 	public Integer update(HospitalDict domain);
 	
 	/**
 	*根据ID查询 医院
 	*/
	@Select("select * from dict_hospital where id=#{id}")
	public HospitalDict findById(Integer id);
	
	/**
 	*通过query 查询 医院
 	*/
 	@SelectProvider(method="findByQuery",type=HospitalDictProvider.class)
 	public List<HospitalDict> findByQuery(HospitalDictQuery query);
 	
 	/**
 	*通过query count总条数
 	*/
 	@SelectProvider(method="countByQuery",type=HospitalDictProvider.class)
 	public Integer countByQuery(HospitalDictQuery query);
 	
 	/**
 	* 通过ids查询
 	*/
 	@SelectProvider(method="findByIds",type=HospitalDictProvider.class)
 	public List<HospitalDict> findByIds(List<Integer> ids);
 	
 	 /**
 	*根据name查询 医院
 	*/
	@Select("select * from dict_hospital where name=#{name} limit 1")
	public HospitalDict findByName(String name);
	
	/**
 	*获取所有字典 医院
 	*/
	@Select("select * from dict_hospital where in_used=1")
	public List<HospitalDict> findAll();
	

}	